//
//  SearchTextFieldDemoViewController.swift
//  ZZUIDemo
//
//  Created by 张文晏 on 2018/11/26.
//  Copyright © 2018 Newcoretech. All rights reserved.
//

import UIKit
import ZZUI

class SearchTextFieldDemoViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.backgroundColor = .white
        
        let searchView = SearchTextField()
        navigationItem.titleView = searchView
        searchView.frame = CGRect(x: 0, y: 0, width: 260, height: 28)
        searchView.delegate = self
    }
    
}

extension SearchTextFieldDemoViewController: UITextFieldDelegate {
    
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
        if let str = textField.text {
            HUD.showMessage(str, position: .center)
        }
        return true
    }
    
}
